//
//  MeViewController.m
//  mendianjieke
//
//  Created by 响当当 on 7/30/19.
//  Copyright © 2019 dongzheng. All rights reserved.
//

#import "MeViewController.h"
#import "MeView.h"

@interface MeViewController ()
@property (nonatomic, strong)MeView *meview;
@end

@implementation MeViewController

- (MeView *)meview
{
    if (!_meview)
    {
        _meview = [[MeView alloc]initWithFrame:CGRectMake(0,NAVIBAR_HEIGHT,SCREEN_WIDTH,SCREEN_HEIGHT-NAVIBAR_HEIGHT-TABBAR_HEIGHT)];
    }
    return _meview;
}

- (void)viewDidLoad
{
    [super viewDidLoad];
    [self setTitle:@"我的"];
    
    [self.view addSubview:self.meview];
    
    [self getUSerInfo];
    [self getActivity];
}

- (void)viewWillAppear:(BOOL)animated
{
    [super viewWillAppear:animated];
 
}

- (void)getUSerInfo
{
    
    [infoManager getUserInfo:[NSDictionary dictionary]
                      sucess:^(id  _Nonnull acceptData) {
                          UserInfoModel *model = [[UserInfoModel alloc]initWithDic:acceptData];
                          self.meview.model = model;
                          
                          LCUserDefaultsSet(model.terminalState.stringValue, @"switch");
//                          LCUserDefaultsSyn;
                      }
                        fail:^(NSError * _Nullable error) {
                            
                        }];
}


- (void)getActivity
{
    
    NSDictionary *pramaters = @{
                                @"refreshToken" : current_User.refrehToken
                                };
    
    [infoManager getActivityInfo:pramaters
                      sucess:^(id  _Nonnull acceptData) {
                          [self.meview getActivityInfo:acceptData];
                      }
                        fail:^(NSError * _Nullable error) {
                            
                        }];
}
@end
